﻿using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Server
{
    /// <summary>
    /// Описание пользователя системы
    /// </summary>
    [DataContract]
    public class User: INullable
    {
        private bool m_Null;
        /// <summary>
        /// Creator of null version o
        /// </summary>        
        [DataMember]
        public static User Null { get { return new User(0) { m_Null = true }; } }

        /// <summary>
        /// Id пользователя
        /// </summary>
        [DataMember]
        public long Id { get; private set; }

        /// <summary>
        /// Логин
        /// </summary>
        [DataMember]
        public string Login { get; set; }

        /// <summary>
        /// Пароль
        /// </summary>
        [DataMember]
        public string Password { get; set; }

        [DataMember]
        public string FIO { get; set; }

        [DataMember]
        public string Email { get; set; }

        [DataMember]
        public string Phone { get; set; }

        /// <summary>
        /// Роль
        /// </summary>
        [DataMember]
        public UserRole Role { get; set; }

        /// <summary>
        /// Место работы, null если просто посетитель
        /// </summary>
        [DataMember]
        public int? PlaceId { get; set; }

        public User (long id)
        {
            Id = id;
        }

        /// <summary>
        /// is this store empty
        /// </summary>
        [DataMember]
        public bool IsNull
        {
            get { return m_Null; }
            set { }
        }
    }
}
